package org.jsola.hr.web;

import org.jsola.core.Page;
import org.jsola.core.Result;
import org.jsola.hr.constant.HrConstants;
import org.jsola.hr.service.IHrActionLogService;
import org.jsola.log.query.ActionLogQuery;
import org.jsola.log.vo.ActionLogListVO;
import org.jsola.user.core.TokenUser;
import org.jsola.user.core.UserContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;


/**
 * 请求日志
 *
 * @author june
 */
@RestController("hrHrActionLogController")
@RequestMapping(HrConstants.API_PATH + "/v1/actionLogs")
public class HrActionLogController implements IHrActionLogControllerAPI {

    @Autowired
    private IHrActionLogService hrActionLogService;

    @Override
    @GetMapping
    public Result<Page<ActionLogListVO>> page(@Valid ActionLogQuery actionLogQuery) {
        TokenUser tokenUser = UserContext.getUser();
        // todo 查看项目权限校验

        return Result.success(
                hrActionLogService.selectPage(actionLogQuery, tokenUser.getSiteId())
        );
    }


}

